import axios from 'axios'
import '.././mock'

export interface UserType {
    id: string,
    name: string,
    nickName: string,
    phone: string,
    deptName: string,
    isMale: boolean,
    email: string,
    createTime: string
}

// 获取用户列表
const getUserList = (params: { page: number, name?: string }) => {
    return axios.get('/user/getUser', { params })
}

// 新增用户
const addUser = (params: UserType) => {
    return axios.get('/user/add', { params })
}

// 修改用户
const updateUser = (params: UserType) => {
    console.log(3333333, '删除')
    return axios.get('/user/edit', { params })
}

// 删除用户
const deleteUser = (id: string ) => {
    return axios.get('/user/remove', { params: { id } })
}

const userApi = {
    getUserList,
    addUser,
    updateUser,
    deleteUser
}

export default userApi